function search(type){
	var input = document.getElementById('search');
	var search = input.value;
	if(search == '') return; //prevent empty searches
	var location = window.location.href;
	var len = location.length;
	//get to main directory
	var directory = location.substring(0, len-8);
	window.location.replace(directory + 'search.php?type=' + type + '&search=' + search + '&');
}